﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using KMT_Pro.ViewModels.ClientViewModels;
using KMT_Pro.Utils;

namespace KMT_Pro.Views.ClientViews
{
    public partial class ClientEditInfoView : ChildWindow
    {
        ClientEditInfoViewModel viewModel = new ClientEditInfoViewModel();

        public ClientEditInfoView(string CompanyID, string CompanyName, string Address, string Gubun, string etc, bool isReadOnly)
        {
            InitializeComponent();
            this.DataContext = viewModel;

            var vm = this.DataContext as ClientEditInfoViewModel;
            if (vm == null) return;
            vm.CompanyID = CompanyID;
            vm.CompanyName = CompanyName;
            vm.Address = Address;
            vm.Companygubun = Gubun;
            vm.Etc = etc;

            if (isReadOnly)
                vm.IsReadOnly = true;
            else
                vm.IsReadOnly = false;
        }

        private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            var vm = this.DataContext as ClientEditInfoViewModel;
            if (vm == null) return;
            vm.editClick.Execute(null);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
}

